import {Component, OnInit, ViewEncapsulation, ChangeDetectionStrategy} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {Subject} from "rxjs/Subject";
import {Subscription} from "rxjs/Subscription";

@Component({
  selector: 'seed-launch-result',
  templateUrl: './launch-result.component.html',
  styleUrls: ['./launch-result.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class LaunchResultComponent implements OnInit {

  public resultStatus: boolean;
  public crowdCode: string;
  public ngUnsubscribe: Subject<void> = new Subject<void>();
  public subscription: Subscription = new Subscription();

  constructor(public router: Router,
              private route: ActivatedRoute
  ) {
    this.subscription.add(
      this.route.queryParams.subscribe(param => {
        this.crowdCode = param['crowdCode'];
      })
    );
  }

  ngOnInit() {

  }

  goToCrowdDetails() {
    this.router.navigate([`/crowd/crowd-details`], {queryParams: {crowdCode: this.crowdCode}});
  }
}
